from django.db import models
from apps.common.base.models import BaseModel
import django.utils.timezone as timezone

class Activity(BaseModel):

    status = (
        ("INITIAL", "初始状态"),
        ("OPEN", "报名中"),
        ("APPLYEND", "报名结束"),
        ("CLOSE", "结束")
    )
    key = (
        ("incomesDeduction", "积分抵扣"),
        ("expenseSendIncomes", "消费赠送积分"),
        ("directSendIncomes", "推荐赠送积分"),
        ("fx", "分销"),
        ("goldCustom", "黄金定制"),
        ("generalGoods", "普通商品"),
        ("discountGoods", "优选商品"),
        ("giftpacks", "大礼包"),
        ("limitedTimeKill", "限时抢购")
    )
    key = models.CharField("活动标记", max_length=200, choices=key, blank=True, default='')
    name = models.CharField("活动名称", max_length=200, blank=True, default='')
    coverUrl = models.CharField("活动封面", max_length=200, blank=True, default='')
    activityIntr = models.TextField("活动介绍", max_length=5000, blank=True, default='')
    activityParams = models.TextField("活动参数", max_length=5000, blank=True, default='')
    price = models.DecimalField("活动显示价格", max_digits=10, decimal_places=2, default=0)
    fansPrice = models.DecimalField("粉丝购买价格", max_digits=10, decimal_places=2, default=0)
    memberPrice = models.DecimalField("会员购买价格", max_digits=10, decimal_places=2, default=0)
    startTime = models.DateTimeField('开始时间', blank=True, default=timezone.now)
    endTime = models.DateTimeField('结束时间', blank=True, default=timezone.now)
    lastTime = models.DateTimeField('报名截止时间', blank=True, default=timezone.now)
    status = models.CharField("状态", max_length=100, choices=status, default="INITIAL")
    remark = models.CharField("备注", max_length=500, blank=True, default='')

    class Meta:
        verbose_name = 'Activity'
        verbose_name_plural = verbose_name